<?php

class Intro_model extends Model {
	
	private $table 	= 'intros';
	
	function Option_model() {
		parent::Model ();
	}
	
	function select_intros() {
		$data = array ();
		
		$query = $this->db->query("SELECT `name`, `detail` FROM `$this->table` WHERE `id_lang` = '".get_admin_lang()."' LIMIT 1 ");
		
		if ( $query->num_rows () > 0 ) 
			$data = $query->row_array();
		
		$query->free_result ();
		
		return $data;
	}
	
	function update_intros() {		
			
		$data = array(			
			'name'		=> isset( $_POST['name'] ) ? htmlspecialchars( $_POST['name'] ) : '',
			'detail'	=> isset( $_POST['detail'] ) ? $_POST['detail'] : '',
			'update'	=> time(),
		);
				
		$this->db->where('id_lang', get_admin_lang() );	
		$this->db->update( $this->table, $data);	
	}
	
}
?>